let constr;
const fun1 = function(str) {
	constr = str.replace(/#/g, "j");
	return constr.replace(/AS/, "h");
}
const fun2 = function() {
	return "1#AStconstr#2age3"
}

const getClientId = function() {
	//获取客户端ID和版本号
	var clientid = '';
	// #ifdef APP-PLUS
	// 苹果系统
	plus.device.getInfo({
		success: function(e) {
			clientid = e.uuid;
			uni.setStorageSync('clientid', clientid);
		},
		fail: function(e) {
			console.log(e);
		}
	});
	// 安卓系统
	plus.device.getAAID({
		success: function(e) {
			clientid = e.aaid;
			console.log(clientid);
			uni.setStorageSync('clientid', clientid);
		},
		fail: function(e) {
			console.log(e);
		}
	});
	//老版本、安卓模拟器
	if (clientid == '') {
		clientid = plus.device.uuid;
		uni.setStorageSync('clientid', clientid);
	}
	// #endif
	return clientid;
}

//校验邮箱格式
function checkEmail(email){
	return RegExp(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/).test(email);
}
//校验手机格式
function checkMobile(mobile){
	return RegExp(/^1[3456789]\d{9}$/).test(mobile);
}



module.exports = {
	fun1,
	fun2,
	getClientId,
	checkEmail : checkEmail,
		checkMobile : checkMobile
}
